package com.nightsoul.hadoop1.test.conf;

import java.util.Map;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;

public class ConfigurationPrinter extends Configured implements Tool {
	static {
		Configuration.addDefaultResource("configuration-1.xml");//类路径下
		Configuration.addDefaultResource("configuration-2.xml");//类路径下
	}

	@Override
	public int run(String[] args) throws Exception {
		Configuration conf = this.getConf();
		for(Map.Entry<String, String> entry : conf) {
			System.out.printf("%s=%s\n", entry.getKey(), entry.getValue());
		}
		return 0;
	}
	
	public static void main(String[] args) throws Exception {
		int exitCode = ToolRunner.run(new ConfigurationPrinter(), args);
		System.exit(exitCode);
	}

}
